#-*-coding:utf-8-*-

'''
# ----------------------------------------------------------------------------
#  Purpose:     用于实现进程处理函数

#  Author:      青衫少年春归也

#  Created:     2019.12.23

# ----------------------------------------------------------------------------
'''
import psutil


class HandleProcess():
    def kill_process(self, pid:int) -> bool:
        """
        杀死指定pid进程号的进程
        参数信息:
            :param pid: 进程号
        返回值:
            :return: 处理结果
        """
        try:
            if pid in psutil.pids():
                each_pro = psutil.Process(pid)
                each_pro.terminate()
                each_pro.wait(timeout=2)
                return True
        except:
            return False
